[#2704] [#2710] Fixed Session fixation-related regressions#2711
Conversation
|
I backported the fix to 2.22.0 locally and tested with Apache Camel (the project which reported the issue initially). it is working fine on Camel side. I tried with main branch 3.x with Apache Camel but there is a differnt error: The provided value for the Ini.loadFromPath is src/test/resources/securityconfig.ini A last note is that when backporting to 2.20, it is working fine for Camel as I mentioned but I have tests failures in Apache Shiro (but maybe I have not backported correctly?): here is the branch I used for the backport: https://github.com/apupier/shiro/pull/new/backport-session-fixation |
|
That is not going to be an issue as
|
There was a problem hiding this comment.
Pull request overview
This PR addresses regressions introduced by session fixation protection in Shiro’s native session management, specifically duplicate-login failures and loss of pre-login session attributes after session id rotation.
Changes:
- Snapshot/restore existing session attributes during
DefaultSecurityManager.beforeSuccessfulLoginsession rotation. - Clear the cached session reference when stopping a session (via a new
DelegatingSubject.sessionStopped()visibility change and an explicit call site). - Add/extend tests to cover duplicate login (#2704) and attribute survival across login rotation (#2710).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| core/src/test/java/org/apache/shiro/subject/DelegatingSubjectTest.java | Adds coverage for duplicate login and for session attribute survival across login session rotation. |
| core/src/main/java/org/apache/shiro/subject/support/DelegatingSubject.java | Changes sessionStopped() visibility to allow external callers to clear cached session state. |
| core/src/main/java/org/apache/shiro/mgt/DefaultSecurityManager.java | Implements attribute snapshot/restore around session stop during login and explicitly clears cached session on stop. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Session fixation enhancements caused regressions.
Affects native session management only
fixes #2704
fixes #2710
Following this checklist to help us incorporate your contribution quickly and easily:
for the change (usually before you start working on it). Trivial changes like typos do not
require a GitHub issue. Your pull request should address just this issue, without pulling in other changes.
[#XXX] - Fixes bug in SessionManager,where you replace
#XXXwith the appropriate GitHub issue. Best practiceis to use the GitHub issue title in the pull request title and in the first line of the commit message.
fixes #XXXif merging the PR should close a related issue.mvn verifyto make sure basic checks pass. A more thorough check will be performed on your pull request automatically.Trivial changes like typos do not require a GitHub issue (javadoc, comments...).
In this case, just format the pull request title like
[DOC] - Add javadoc in SessionManager.If this is your first contribution, you have to read the Contribution Guidelines
If your pull request is about ~20 lines of code you don't need to sign an Individual Contributor License Agreement
if you are unsure please ask on the developers list.
To make clear that you license your contribution under the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.